home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / business / istar.lha / Docs / Inference < prev    next >
Text File  |  1996-06-26  |  16KB  |  643 lines

  1. INFERENCE METHODS
  2.  
  3. This is a reference guide to the types of inference methods available in 
  4. the 'es' module of IRKit, as used in KBTools/Istar.  Each method is known 
  5. by a short identifier of the for esIM_XXX where XXX is its name.  The 
  6. prefix, esIM, means 'es' module Inference Method, and these names are those 
  7. found in the program (e.g. in the es.h include file).
  8.  
  9.       For each method we give the following information:
  10.  
  11. 1.  esIM_XXX name
  12. 2.  Its normal label in a list view gadget - what the knowledge engineer is 
  13. likely to see.
  14. 3.  What it does.
  15. 4.  What types of antecedents is acts on or requires.
  16. 5.  What types of consequents is requires.
  17. 6.  Advanced use.
  18. 7.  Any stopping rule that makes the result answered before all antecedents 
  19. have been searched by backward chaining.
  20.  
  21.  
  22. esIM_ADD            "X = A + B, C, ..."
  23. esIM_SUB            "X = A - B, C, ..."
  24.  
  25. Action
  26.  
  27.       With integers and floating point numbers these perform simple
  28. addition and subtraction.  The first antecedent is taken (converted to 
  29. integer or floating point as needed), and then all the others are added to 
  30. or subtracted from it, accumulating a result as we take each antecedent. 
  31. For simple use, ensure that all antecedents are integer or float.
  32.  
  33. Antecedents
  34.  
  35.       These act on numeric antecedents.
  36.  
  37. Consequents
  38.  
  39.       Integer, Float, Angle/Direction, Enum, Ordinal.  Others in future,
  40. perhaps.
  41.  
  42. Advanced use
  43.  
  44.       When B (and C etc.) is a PROPORTION the inference is different: it
  45. adds that proportion of what is already accumulated.  Thus (60 + 50%) gives 
  46. 90, not 110.  If C, D, etc. is a PROPORTION, it takes a proportion of what 
  47. is already accumulated, not just of A.  Thus if A is 60, B is 50%, C is 20 
  48. and D is 10% the result is:
  49.  
  50.       #  take A to give 60
  51.       #  add B=50% of that to give 90
  52.       #  add C=20 to give 110
  53.       #  add D=10% of that to give 121.
  54.  
  55. At present, probabilities, Bayesians, odds and ratios act as proportions 
  56. do.
  57.  
  58. esIM_MULT          "X = A * B, C, ..."
  59. esIM_DIV             "X = A / B, C, ...)"
  60.  
  61. Action
  62.  
  63.       A is taken and then multiplied or divided by the rest.
  64.  
  65. Stopping
  66.  
  67.       With multiplication, if an antecedent makes the result zero then no
  68. further ones are taken.
  69.  
  70. Antecedents
  71.  
  72.       These act on numeric antecedents.
  73.  
  74. Consequents
  75.  
  76.       Integer, Float or Angle/Direction.
  77.  
  78. Advanced use
  79.  
  80.       The stopping rule can be used to control the order in which questions
  81. are asked.
  82.  
  83.  
  84. esIM_AND            "X = A & B & C & ..."
  85. esIM_OR              "X = A | B | C | ..."
  86.  
  87. Action
  88.  
  89.       The result is the normal boolean AND or OR of all the antecedents.
  90.  
  91. Stopping
  92.  
  93.       With AND, if any antecedent in order A, B, C ... is FALSE, no others
  94. are taken.  With OR, if any is TRUE, no others are taken.
  95.  
  96. Antecedents
  97.  
  98.       These act on boolean antecedents.  Any other type is converted to
  99. boolean if possible before being accumulated into the result.
  100.  
  101. Consequents
  102.  
  103.       Boolean.
  104.  
  105. Advanced use
  106.  
  107.       The stopping rule can be used to control the order in which questions
  108. are asked.
  109.  
  110.  
  111. esIM_NOT            "X = !(A)"
  112.  
  113. Action
  114.  
  115.       Gives the NOT of the antecedent.
  116.  
  117. Antecedents
  118.  
  119.       This acts on a single boolean antecedent, and ignores all others.
  120.  
  121. Consequents
  122.  
  123. Advanced use
  124.  
  125.  
  126. esIM_PROBAND    "p(X) = p(A) & p(B) &..."
  127. esIM_PROBOR               "p(X) = p(A) | p(B) |..."
  128. esIM_PROBNOT    "p(X) = 1 - p(A)"
  129.  
  130. Action
  131.  
  132.       They give, respectively, the probabilistic AND, OR and NOT.
  133.  
  134. Antecedents
  135.  
  136.       These act on probabilistic antecedents.  Proportions are treated as
  137. probabilities.  Bayesians have their main part treated as a probability. 
  138. Booleans are converted to probability.  Odds are converted to probability 
  139. in the normal manner, viz. P = O / (1 + O).
  140.  
  141. Consequents
  142.  
  143. Advanced use
  144.  
  145.  
  146. esIM_BAYES        "Bayesian"
  147.  
  148. Action
  149.  
  150.       A very useful inference for decision support systems, this performs a
  151. Bayesian accumulation of beliefs of evidence to come to a level of belief 
  152. in a conclusion.
  153.  
  154.       That is, the consequent and antecedents are all levels of belief in
  155. various propositions.  e.g. (Antecedent belief that) the bird has a red 
  156. breast and (antecedent belief that) the bird is small might be evidence for 
  157. (consequent belief that) the bird is a (British) robin, and (antecedent 
  158. belief that) the bird has a thick bill would be evidence against.  (For 
  159. 'belief' you can also say 'probability'.)
  160.  
  161.       This form of inference is found in artificial intelligence.
  162.  
  163. Stopping
  164.  
  165.       Normally there is no stopping rule.  But you can define a Lower or
  166. Upper Cut-Off to ignore any weak evidence once you are sufficiently 
  167. confident in the present result.  Suppose you have six antecedents and a 
  168. Lower Cut-Off of 10% on the consequent, and that three of the antecedents 
  169. have been answered in such a way as to bring the belief in the consequent 
  170. down to 5%.  Then if the other three (unanswered) antecedents have 
  171. sufficiently weak evidence that however they are answered their combined 
  172. effect will not bring the final result over 10%, then the consequent is 
  173. considered answered.  So the three remaining antecedents are not searched 
  174. during the backward chaining process.  Conversely for the Upper Cut-Off.
  175.  
  176. Antecedents
  177.  
  178.       This acts on Bayesian antecedents.  Probabilities, proportions and
  179. booleans are converted to Bayesian whose a-priori is 0.5 (50%).
  180.  
  181. Consequents
  182.  
  183.       Bayesian.
  184.  
  185. Advanced use
  186.  
  187.       Using the Lower and Upper Cut-Offs you can make the knowledge base
  188. appear more 'intelligent' and less pedantic.
  189.  
  190.       To understand Bayesian accumulation of evidence, read the following.
  191.  
  192.       The consequent belief is an accumulation of the antecedent beliefs,
  193. for and against.  Each antecedent can have a different weight, so that 
  194. having a red breast is of greater weight (more conclusive) as evidence for 
  195. the bird being a robin than that the bird is small.  Evidence against (such 
  196. as thick bill) is also indicated by the weights, and in this case the 
  197. weight would be inverted.
  198.  
  199.       The weights are held as parameters of the relationship that joins the
  200. antecedent to the consequent.  All antecedent relationships must have a UOp 
  201. of either 'Normal' or 'Negate', and are expected to hold a Bayesian Weight, 
  202. which is two odds multipliers - four small positive integers in all.  One 
  203. pair should give a ratio >= 1 and the other pair should give a ratio <= 1. 
  204. The distance these ratios are from 1 the 'stronger' the weight for this 
  205. antecedent.
  206.  
  207.       If belief in the antecedent is total (e.g. 100%) then the full weight
  208. found in the relationship is taken and accumulated into the consequent 
  209. belief.  But if the belief is partial then only part of the weight is 
  210. taken.  By "total" we mean either that the antecedent is definitely known 
  211. to be true (100%) or definitely known to be false (0%).
  212.  
  213.       The consequent and each antecedent has an a-priori belief, which is
  214. the belief which would be taken if there were no evidence.  (The a-priori 
  215. is often found from the statistical probability of the proposition being 
  216. true.)  The a-priori belief of the consequent is the starting point for 
  217. accumulation.  e.g. The a-priori belief that the bird is a robin might be 
  218. 10%, and as evidence is accumulated for or against the belief varies from 
  219. this level.  When the proposition is an antecedent of a Bayesian inference 
  220. then the a-priori is also used to calculate partial weights.  If the belief 
  221. is precisely that of the a-priori then the antecedent has zero weight, no 
  222. effect.  As the belief moves away from the a-priori of the antecedent the 
  223. amount of the weight taken increases until the whole is taken for a total 
  224. belief.
  225.  
  226.       For details, see the section on Bayesian accumulation.
  227.  
  228.  
  229. esIM_EQ              "Whether A = all"
  230. esIM_NE              "Whether A <> all"
  231.  
  232. Action
  233.  
  234.       These can take most types of antecedent, and yields a boolean result.
  235. All antecedents after the first, viz. B, C, D, ..., are converted to the 
  236. type of the first before the comparison.
  237.  
  238.       The result is TRUE is A equals all the rest, is unequal to all the
  239. rest, respectively.
  240.  
  241. Stopping
  242.  
  243.       Answered as soon as it is known the result is false, so no further
  244. antecedents will be searched during backward chaining.
  245.  
  246. Antecedents
  247.  
  248.       A:  Any.
  249.       Others:  Any convertible to type of A.
  250.  
  251. Consequents
  252.  
  253.       Boolean.
  254.  
  255. Advanced use
  256.  
  257.       Owing to the stopping rule, this can be used to control the order in
  258. which questions are asked of the user.
  259.  
  260.  
  261. esIM_GT              "Whether A > all"
  262. esIM_LT               "Whether A < all"
  263. esIM_GE              "Whether A >= all"
  264. esIM_LE               "Whether A <= all"
  265.  
  266. Action
  267.  
  268.       These all perform comparisons in a similar manner to the above.  The
  269. difference is that the antecedents must by numeric or string.
  270.  
  271. Antecedents
  272.  
  273.       A: Any numeric or ordinal.
  274.       Others:  Any convertible to type of A.
  275.  
  276. Consequents
  277.  
  278.       Boolean.
  279.  
  280. Advanced use
  281.  
  282.  
  283. esIM_PEQ            "% A ="
  284. esIM_PGT            "% A >"
  285. esIM_PLT             "% A <"
  286. esIM_PNE            "% A <>"
  287. esIM_PGE            "% A >="
  288. esIM_PLE             "% A <="
  289.  
  290. Action
  291.  
  292.       These perform comparisons similar to the above, but they find the
  293. proportion for which the comparison is true, rather than whether all are 
  294. true.
  295.  
  296. Antecedents
  297.  
  298.       A: Any numeric or ordinal.
  299.       Others:  Any convertible to type of A.
  300.  
  301. Consequents
  302.  
  303.       The result is a Proportion (or Probability or Bayesian).
  304.  
  305. Advanced use
  306.  
  307. esIM_CEQ            "Count A ="
  308. esIM_CGT            "Count A >"
  309. esIM_CLT             "Count A <"
  310. esIM_CNE            "Count A <>"
  311. esIM_CGE            "Count A >="
  312. esIM_CLE             "Count A <="
  313.  
  314. Action
  315.  
  316.       These perform comparisons similar to the above, but count the number
  317. for which the comparison is true.
  318.  
  319. Antecedents
  320.  
  321.       A: Any numeric or ordinal.
  322.       Others:  Any convertible to type of A.
  323.  
  324. Consequents
  325.  
  326.       Integer.
  327.  
  328. Advanced use
  329.  
  330.  
  331. esIM_ISIN            "A is found in all B, C, ..."
  332. esIM_CISIN          "How many A is in"
  333. esIM_PISIN           "% A is in"
  334.  
  335. Action
  336.  
  337.       These look to see if A 'is in' all the other antecedents, and return
  338. either a truth value, a number or a proportion (as in the comparisons 
  339. above).
  340.  
  341.       By 'is in' we mean one of two things.  If all antecedents are
  342. strings, then is looks to see if A is a substring of all other antecedents. 
  343. If all antecedents are integers, it looks to see if A is a factor of all 
  344. the others.
  345.  
  346. Antecedents
  347.  
  348.       A:  String or integer.
  349.       Others:  Must be like A or convertible to A's type.
  350.  
  351. Consequents
  352.  
  353.       esIM_HAS:  Boolean.
  354.       esIM_CHAS:  Integer.
  355.       esIM_PHAS:  Proportion, Probability or Bayesian.
  356.  
  357. Advanced use
  358.  
  359.  
  360. esIM_HAS            "A contains all B, C, ..."
  361. esIM_CHAS          "How many are in A"
  362. esIM_PHAS          "% in A"
  363.  
  364. Action
  365.  
  366.       These operate inversely to the above.  They count or find the
  367. proportion of antecedents after the first (A), that are 'in' A in the sense 
  368. defined above.  That is, if strings, whether each is a substring of A, and 
  369. if integers, if each is a factor of A.
  370.  
  371. Antecedents
  372.  
  373.       A:  String or integer.
  374.       Others:  Must be like A or convertible to A's type.
  375.  
  376. Consequents
  377.  
  378.       esIM_HAS:  Boolean.
  379.       esIM_CHAS:  Integer.
  380.       esIM_PHAS:  Proportion, Probability or Bayesian.
  381.  
  382. Advanced use
  383.  
  384.  
  385. esIM_FIRSTKNOWN       "First Known"
  386.  
  387. Action
  388.  
  389.       This finds the first antecedent that has a known value.  It is useful
  390. for instance in allowing the user to answer 'Unknown' and then inferring 
  391. the value by other means.  It can take any type of antecedent that is 
  392. convertible to the type of the consequent.
  393.  
  394. Antecedents
  395.  
  396.       Any that can be converted to type of consequent.
  397.  
  398. Consequents
  399.  
  400.       Any.
  401.  
  402. Advanced use
  403.  
  404.       With this you can provide sophisticated strategies of questioning the
  405. user or otherwise finding out information.
  406.  
  407.  
  408. esIM_FIRSTOK      "Present Each to User"
  409.  
  410. ** This is current not available
  411.  
  412. Action
  413.  
  414.       This takes the value of the first antecedent and presents it to the
  415. user for acceptance.  The user can accept or reject it.  If s/he rejects 
  416. it, then the second is presented, and so on until one is accepted.  If none 
  417. is accepted then result is Unknown.  It can take any type of antecedent 
  418. that is convertible to the type of consequent.
  419.  
  420. Antecedents
  421.  
  422.       Any, converted to consequent type.
  423.  
  424. Consequents
  425.  
  426.       Any.
  427.  
  428. Advanced use
  429.  
  430.       You can use this to build 'critiquing' systems, which ask a few
  431. questions, come to a conclusion and then ask the user "Is this the answer 
  432. you want?" and if not then probe the user with more questions.
  433.  
  434.  
  435. esIM_CHOICE                "Chooser"
  436.  
  437. Action
  438.  
  439.       This acts like an array or small database.  It chooses one
  440. antecedent.  If A is integer, it chooses the Ath among the rest.  That is, 
  441. if A is 1 it chooses B, if 2, it chooses C, etc.  If 0, it returns Unknown. 
  442. If A is boolean, it chooses B if A is false, and C if A is true.
  443.  
  444. Antecedents
  445.  
  446.       A:  Anything that can be converted to integer.
  447.       Others:  Converted to type of consequent.
  448.  
  449. Consequents
  450.  
  451.       Any.
  452.  
  453. Advanced use
  454.  
  455.       Note that in backward chaining, it first gets A answered and once its
  456. value is found will only backward chain up the appropriate chosen 
  457. antecedent.  In this way you can cut out whole sections of questioning if 
  458. you wish.
  459.  
  460.  
  461. esIM_ALLANS               "All Answered"
  462.  
  463. Action
  464.  
  465.       This returns TRUE or FALSE, depending on whether all antecedents are
  466. in an answered state.  They can be of any type.
  467.  
  468. Antecedents
  469.  
  470.       Any.
  471.  
  472. Consequents
  473.  
  474.       Boolean.
  475.  
  476. Advanced use
  477.  
  478.  
  479. esIM_COUNTANS "How many Answered"
  480.  
  481. Action
  482.  
  483.       This counts the number of antecedents that are answered.  They can be
  484. of any type.
  485.  
  486. Antecedents
  487.  
  488.       Any.
  489.  
  490. Consequents
  491.  
  492.       Integer.
  493.  
  494. Advanced use
  495.  
  496. Beware: The consequent is always known and answered.
  497.  
  498. esIM_COUNTKNOWN     "How many Known"
  499.  
  500. Action
  501.  
  502.       This counts the number of antecedents that have known values.  They
  503. can be of any type.
  504.  
  505. Antecedents
  506.  
  507.       Any.
  508.  
  509. Consequents
  510.  
  511.       Integer.
  512.  
  513. Advanced use
  514.  
  515.  
  516. esIM_COUNT                "No of Antes"
  517.  
  518. Action
  519.  
  520.       This is simply a count of the antecedents.  Like a constant, but you
  521. don't have to set it manually if you add another.
  522.  
  523. Antecedents
  524.  
  525.       Any.
  526.  
  527. Consequents
  528.  
  529.       Integer.
  530.  
  531. Advanced use
  532.  
  533.  
  534. esIM_IRAND         "X = A + (Rand * (B - A))"
  535.  
  536. Action
  537.  
  538.       This produces a random number.  At present, the antecedents are
  539. irrelevant.  It uses the FastRand algorithm.
  540.  
  541. Antecedents
  542.  
  543.       Any.
  544.  
  545. Consequents
  546.  
  547.       Integer.
  548.  
  549. Advanced use
  550.  
  551.  
  552. esIM_MAX           "Max"
  553. esIM_MIN            "Min"
  554.  
  555. Action
  556.  
  557. These act on numeric or string antecedents.  They find which one is maximum 
  558. or minimum.
  559.  
  560. Antecedents
  561.  
  562.       Anything that can be converted to type of consequent.
  563.  
  564. Consequents
  565.  
  566.       Numeric or string.  The antecedents are converted to type of
  567. consequent.
  568.  
  569. Advanced use
  570.  
  571.       These act on numeric or string antecedents.  They return the maximum
  572. or minimum value.
  573.  
  574.  
  575. esIM_WHICHMAX "Which Max"
  576. esIM_WHICHMIN  "Which Min"
  577.  
  578. Action
  579.  
  580. These act on numeric or string antecedents.  They find which one is maximum 
  581. or minimum.
  582.  
  583. Antecedents
  584.  
  585.       Most numerics and string.
  586.  
  587. Consequents
  588.  
  589.       Integer, ENUM or ORDINAL (in which case the answer is 1 if A is
  590. max/min, 2 if B, and so on).
  591.       Or BLOCK, in which case the result is the DSAP of the antecedent
  592. block.
  593.  
  594. Advanced use
  595.  
  596.       The use of BLOCK consequent is expected to become more versatile in
  597. future, but at present you can find for instance the name of the block by 
  598. conversion to string at the next stage.
  599.  
  600.  
  601. esIM_AVG            "Mean"
  602.  
  603. Action
  604.  
  605.       This acts on certain numeric antecedents, and returns the mean
  606. (average) of them.
  607.  
  608. Antecedents
  609.  
  610.       Numeric.
  611.  
  612. Consequents
  613.  
  614.       Numeric.
  615.  
  616. Advanced use
  617.  
  618.  
  619. esIM_CONCAT              "Concat"
  620.  
  621. Action
  622.  
  623. This concatenates string antecedents.  e.g. "cat" and "dog" antecedents 
  624. gives consequent "catdog" (note: no spaces; an option for spacing might be 
  625. added in future).
  626.  
  627. In future CONCAT is likely to be used for any data that is essentially a 
  628. linear sequence, such as sound samples, songs, animations, lists, arrays.
  629.  
  630. Antecedents
  631.  
  632.       If the antecedents are not string type then they are converted to
  633. string if possible.
  634.  
  635. Consequents
  636.  
  637.       String.
  638.  
  639. Advanced use
  640.  
  641.  
  642. Copyright (c) Andrew Basden, 1996
  643.